import { reqCategoryList, reqGetBannerLlist, reqFloorList } from '@/api';
//home模块小仓库
const state = {
  categoryList: [],
  bannerList: [],
  floorList: []
}
const mutations = {
  CATEGORYLIST(state, categoryList) {
    state.categoryList = categoryList
  },
  GETBANNERLIST(state, bannerList) {
    state.bannerList = bannerList
  },
  GEtFLOORLIST(state, floorList) {
    state.floorList = floorList
  }
}
const actions = {
  //获取三级联动数据
  async categoryList({ commit }) {
    let result = await reqCategoryList()
    if (result.code == 200) {
      commit('CATEGORYLIST', result.data)
    }
  },
  //获取轮廓图数据
  async getBannerList({ commit }) {
    const result = await reqGetBannerLlist();
    if (result.code === 200) {
      commit('GETBANNERLIST', result.data)
    }
  },
  async getFloorList({ commit }) {
    const result = await reqFloorList();
    if (result.code === 200) {
      commit('GEtFLOORLIST', result.data);
    }
  }
}


const getters = {}

export default {
  state,
  mutations,
  actions,
  getters
}